package com.xialuo.config;


import com.xialuo.interceptor.MyInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class MyMvcConfig implements WebMvcConfigurer {

    public  static  Logger logger = LoggerFactory.getLogger(Object.class);

    @Autowired
    public MyInterceptor myInterceptor;

    /**
     * 拦截器配置
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        logger.info("配置类");
       // registry.addInterceptor(myInterceptor).addPathPatterns("/**").excludePathPatterns("/index");
        ///使用shiro

    }



    /**
     * 视图控制器
     * @param registry
     */
    @Override
    public  void addViewControllers(ViewControllerRegistry registry) {

        registry.addViewController("/login").setViewName("admin/index");
    }


}